package cn.codingjc.provider.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author shenjicheng
 * @date 2022/7/3 1:15 PM
 */

@Configuration
public class SwaggerConfig {

    private ApiInfo getApiInfo(){
        return new ApiInfoBuilder().title("部门微服务")
                .description("实现部门微服务的统一管理")
                .termsOfServiceUrl("http://codingjc.github.io")
                .contact(new Contact("codingjc", "http://codingjc.github.io", "codingjc@163.com"))
                .version("1.0")
                .build();
    }

    @Bean
    public Docket getDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(getApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("cn.codingjc.provider.action"))
                .paths(PathSelectors.any())
                .build();
    }
}
